<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<!-- saved from url=(0019)http://guajibao.me/ -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">


    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>不关机的云端电脑</title>
    <link rel="icon" type="image/x-icon" mce_href="/favicon.ico" href="image/favicon.ico">
    <link rel="stylesheet" href="css/bootstrap.css">
    <link rel="stylesheet" href="css/bootstrap-docs.min.css">
    <!--[if lt IE 8]>
    <link rel="stylesheet" href="css/bootstrap-ie7.css">
    <![endif]-->
    <link rel="stylesheet" href="bootstrap/plugin/bootstrap3-dialog/css/bootstrap-dialog.min.css
    "/>

    <script src="js/jquery.min.js"></script>
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>

    <![endif]-->
    <script src="js/bootstrap.js" type="text/javascript"></script>
    <script type="text/javascript" src="bootstrap/plugin/jquery-dataTables/jquery.dataTables.min.js"></script>
    <script type="text/javascript" src="bootstrap/plugin/jquery-dataTables/dataTables.bootstrap.min.js"></script>
    <script type="text/javascript"
            src="bootstrap/plugin/bootstrap3-dialog/js/bootstrap-dialog.min.js"></script>
</head>

<body data-spy="scroll" data-target="#myScrollspy">

<div>
    <nav class="navbar-l1 navbar-default navbar-static-top" role="navigation" style="background-color:#008eb7;"
         onmouseover="javascript:$('#navbar-brand').css('color','#fff');"
         onmouseout="javascript:$('#navbar-brand').css('color','#00a2ca');">
        <div class="container-fluid">
            <div class="navbar-header">
                <a id="navbar-brand" class="navbar-brand" style="" href="/">vpsb2c.com</a>
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                        data-target="#bs-navbar-collapse-1"><span class="sr-only">Toggle navigation</span><span
                        class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button>
            </div>
            <div class="collapse navbar-collapse" id="bs-navbar-collapse-1">
                <ul class="nav navbar-nav navbar-right">
                    <li><a style="" href="/?mode=profile" title="当前用户：jiaoming42">您好，${loginedUser.nickname}</a></li>
                    <li></li>
                    <li></li>
                    <li><a style="" href="/logout" title="退出系统"><span
                            class="glyphicon glyphicon-log-out"></span>退出系统</a></li>

                </ul>
            </div>
            <!-- /.navbar-collapse -->
        </div>
        <!-- /.container-fluid -->
    </nav>
    <nav class="navbar-l2 navbar-default navbar-static-top" role="navigation">
        <div class="container-fluid">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                        data-target="#bs-navbar-collapse-2"><span class="sr-only">Toggle navigation</span><span
                        class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button>
            </div>
            <div class="collapse navbar-collapse" id="bs-navbar-collapse-2">
                <ul class="nav navbar-nav">
                    <c:choose>
                        <c:when test="${loginedUser.role == 0}">
                            <li class="active"><a style="padding-left:20px;padding-right:20px;" href="/">我的</a></li>
                        </c:when>
                        <c:otherwise>
                            <li class="active"><a style="padding-left:20px;padding-right:20px;" href="/">我的</a></li>
                            <%--<li><a style="padding-left:20px;padding-right:20px;" href="/recordVps">VPS登记</a></li>--%>
                            <li><a style="padding-left:20px;padding-right:20px;" href="/userList">用户列表</a></li>
                            <li><a style="padding-left:20px;padding-right:20px;" href="/hostList">主机</a></li>
                            <%--<li><a style="padding-left:20px;padding-right:20px;" href="/income">流水</a></li>--%>
                            <c:if test="${loginedUser.role == 2}">
                                <li><a style="padding-left:20px;padding-right:20px;" href="/admin">设置管理员</a></li>
                            </c:if>
                        </c:otherwise>
                    </c:choose>


                </ul>
            </div>
            <!-- /.navbar-collapse -->
        </div>
        <!-- /.container-fluid -->
    </nav>
    <div class="container-fluid">

        <div class="page-header">
            <div class="row">
                <div class="col-md-7 btn-group">
                    <h4>修改密码信息

                    </h4>
                </div>
                <div class="col-md-5 dropdown btn-group">
                </div>
            </div>
        </div>

        <div class="row" style="margin-left: 10px;margin-right: 10px">

            <form id="frm" class="form-horizontal" role="form" method="post" action="/doModifyPasswod">

                <div class="form-group">
                    <label for="oldPassword" class="col-sm-2 control-label">原密码：</label>
                    <div class="col-sm-5">
                        <input type="password" name="oldPassword"   class="form-control" id="oldPassword" required>
                    </div>
                </div>
                <div class="form-group">
                    <label for="password" class="col-sm-2 control-label">新密码：</label>
                    <div class="col-sm-5">
                        <input type="password" name="password" value="" class="form-control" id="password" required>
                    </div>
                </div>
                <div class="form-group">
                    <label for="confirmPassword" class="col-sm-2 control-label">确认密码：</label>
                    <div class="col-sm-5">
                        <input type="password" name="confirmPassword"  class="form-control" id="confirmPassword" required >
                    </div>
                </div>
                <div style="border-top: 1px solid #eee;"></div>
                <div class="row">&nbsp;</div>
                <div class="row">
                    <div class="col-sm-offset-2 col-md-2">
                        <button type="submit" class="btn btn-primary btn-block" role="button">提交</button>
                        <input type="hidden" name="mode" value="submitProfile">
                    </div>
                    <div class="col-md-2">
                        <a href="/" class="btn btn-default btn-block" role="button">取消</a>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function () {
        $("#frm").submit(function () {
            if ($("#password").val() != $("#confirmPassword").val()) {
                alert("密码不匹配");
                $("#confirmPassword").focus();
                return false;
            }
            var url = "/doModifyPasswod"; // the script where you handle the form input.
            $.ajax({
                type: "POST",
                url: url,
                data: $("#frm").serialize(), // serializes the form's elements.
                success: function (data) {
                    if (data.succ) {
                        BootstrapDialog.show({
                            title: '温馨提示',
                            message: '修改成功哦给你',
                            closable: false,
                            buttons: [{
                                label: '返回个人中心',
                                action: function(dialog) {
                                    window.location = "/" ;
                                }
                            }]
                        });
                    }
                    else {

                        BootstrapDialog.show({
                            title: '温馨提示',
                            message:  data.msg,
                            closable: false,
                            type:  BootstrapDialog.TYPE_DANGER,
                            buttons: [ {
                                label: '知道了',
                                action: function(dialogItself){
                                    dialogItself.close();
                                }
                            }
                            ]
                        });
                    }

                }
            });

            return false; // avoid to execute the actual submit of the form.
        });
    });
</script>
</body>
</html>
